package service;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

public class MyBeanPostProcessor implements BeanPostProcessor {

	@Override
	public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
		System.out.println("执行---before---()方法");
		System.out.println("bean:"+bean);//bean表示当前正在初始化的对象
		System.out.println("beanName:"+beanName);//beanName表示当前正在初始化的对象的id
		return bean;
	}

	@Override
	public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
		System.out.println("执行---after---()方法");
		return bean;
	}

}
